<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<include file="Public:meta" />
	<style>
		#InfoHit{	color:#00F;	font-weight:bold;}
		.WINNT{ color:black; font-weight:bold;}
		.Linux{ color: #00F; font-weight:bold;}
	</style>
</head>
<body id="main_page">
<include file="Public:position" />
<div id="dlgOwner" style="display:none">
    <table cellpadding="3" cellspacing="3" border="0">
    <tr>
       <th>
	   	<select name="DlgCustomerID" id="DlgCustomerID">
			<volist name="CustomerData" id="c">
				<option  value="{$c.MemberID}" >
					{$c.MemberID}&nbsp;&nbsp;{$c.MemberName}&nbsp;&nbsp;{$c.MemberRealName}
					<neq name="c.MemberGroupID" value="101">&nbsp;&nbsp;{$c.MemberGroupName}</neq>
				</option>
			</volist>
		</select>
	   </th>
    </tr>
    </table>
</div>
<div class="container">
            	<form enctype="multipart/form-data"  method="post" id="frm">
                <input type="hidden" name="NowPage" id="NowPage" value="{$NowPage}" />
                  <div class="table">
                    <div  class="toolbars">
                    <li class="toolbar">
                    <label>域名</label>&nbsp;&nbsp;<input type="text" class='textinput' name="Host" style="width:150px" value="{$Host}" id="Host"/>&nbsp;&nbsp;&nbsp;
                    <label>所属客户</label>&nbsp;<select name="CustomerID" id="CustomerID">
                    <option value="-1" selected="selected">全部客户</option>
                    <volist name="CustomerData" id="a">
                        <option  value="{$a.MemberID}" <eq name="a.MemberID" value="$CustomerID">selected="selected"</eq> >
                            {$a.MemberID}&nbsp;&nbsp;{$a.MemberName}&nbsp;&nbsp;{$a.MemberRealName}
                            <neq name="a.MemberGroupID" value="101">&nbsp;&nbsp;{$a.MemberGroupName}</neq>
                        </option>
                    </volist>
                    </select>&nbsp;&nbsp;&nbsp;
                    <input id="btnSeek" type="submit" value="查询" onclick="Search()" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    </li>
                    <li class="toolbar">授权域名总数：<b style="color:blue;">{$AuthorizeCount}</b></li>
                    <li class="toolbar" style="color:red; text-indent:2em;">
                    <b>注意：</b>
                    本功能只能授权，不能取消授权，如要取消授权请联系厂商！
                    </li>
                    </div>
	<table class="datatable" id="datatable">
	<tr>
		<th width="45px">序号</th>
		<th width="230px">域名</th>
		<th width="55px" >版本号</th>
		<th width="65px" >操作系统</th>
		<th width="70px" nowrap="nowrap">是否授权</th>
		
		<th width="130px" nowrap="nowrap">授权时间</th>
		<th width="220px" >所属客户</th>
		<th>备注</th>
		<th width="75px" >操作员</th>
		<th width="190px" >操作</th>
	</tr>  
    <notempty name="Data">                
    <volist name="Data" id="i" key="j">
    <tr>
		<td style="font-weight:bold;">{$j}</td>
        <td  style="text-align:left;padding-left:5px;"><a href="http://{$i.Host}" target="_blank">{$i.Host}</a></td>
        <td>{$i.Version}</td>
        <td><span  class="{$i.OS}">{$i.OS}</span></td>
        <td><eq name="i.IsAuthorize" value="1"><b style="color:green">已授权<else/><b style="color:#F00">未授权</eq></b></td>
        <td><eq name="i.IsAuthorize" value="1">{$i.AuthorizeTime|strtotime|yd_friend_date}</eq></td>
		<td><notempty name="i.CustomerID">{$i.CustomerName}&nbsp;[{$i.CustomerID}]&nbsp;</notempty>
		<notempty name="i.OEM"><br/><span style="color:blue;">{$i.OEM}</span></notempty>
		</td>
		
		<td style="text-align:left;">{$i.Remark}</td>
		<td>{$i.OperatorName}</td>
        <td class="operator">
            <empty name="i.CustomerID">
            	<a style="float:left" id="btnSaveAll" href="#" target="_self" onclick="SetCustomer({$i.AuthorizeID})">指定所属客户</a>
            </empty>
            <eq name="i.IsAuthorize" value="0">
                <div class="btn-sep"></div>
                <a style="float:left" onclick="Authorize(1, {$i.AuthorizeID})" id="btnCheck">授权</a>
            </eq>
        </td>
    </tr>
    </volist>
    <else/>
    	<tr><td colspan="10" id="NoData">{$Think.lang.NoDataTip}</td></tr>
    </notempty>                                
    </table>
         <div class="tfoot"><div class="page"><span class="pagesize">每页<span class="pz">{$AdminPageSize}</span>条</span>&nbsp;&nbsp;{$Page}</div></div>
                </div>
</form>
</div>
</body>
</html>
<script type="text/javascript">
//查询
function Search(){
	$('#frm').attr("action", "__URL__/index");
	$('#frm').submit();
	return true;
}

function Authorize(value, id){
	if( value == 1 ){
		$.confirm("<div id='icon_common'>确定授权吗?</div>", function () {
			$('#frm').attr("action", "{$Url}Authorize/Authorize/1/AuthorizeID/"+id);
			$('#frm').submit();
		}, function () {
			return true;
		});
	}else{
		$.confirm("<div id='icon_common'>确定取消授权吗?</div>", function () {
			$('#frm').attr("action", "{$Url}Authorize/Authorize/0/AuthorizeID/"+id);
			$('#frm').submit();
		}, function () {
			return true;
		});
	}
}

//提示信息
$(document).ready(function(){
	//选中操作
	$("#Host").attr("value",'{$Host}');
	$("#IsAuthorize").attr("value",'{$IsAuthorize}');
});

//充值
function SetCustomer(id){
		$.dialog({
			title: "请选择客户",
			id: 'owner',
			padding: 5,
			content: document.getElementById('dlgOwner'),
			ok: function () {
				var CustomerID = $('#DlgCustomerID').val();
				var url = "{$Url}setCustomer";
				var data =  {
					CustomerID: CustomerID, 
					AuthorizeID: id
				};
				$.get(url, data, function(data, textStatus){
					if (data.status == 1){
						SucceedBox(data.info);
						window.location.reload();
					}else if(data.status == 0){
						ErrorBox(data.info);
					}
				}, 'json');
				return true;
			},
			okValue: '确定',
			cancelValue: '关闭',
			cancel: true
		});
}
</script>